package com.demo.user.util.page;


import org.apache.commons.lang3.StringUtils;

/**
 * @author xxh
 */
public enum OrderEnum {

    DESC("desc"),
    ASC("asc");

    private String orderType;

    public String getOrderType() {
        return orderType;
    }

    OrderEnum(String orderType) {
        this.orderType = orderType;
    }

    public static OrderEnum fromType(String type) {

        if (StringUtils.isBlank(type)) {
            return null;
        }
        for (OrderEnum orderEnum : OrderEnum.values()) {
            if (orderEnum.getOrderType().equals(type)) {
                return orderEnum;
            }
        }
        return null;
    }
}
